import 'package:enjoy_plus_community/constants/gaode.dart';
import 'package:enjoy_plus_community/utils/http.dart';

Future<List> queryNearbyCommunities(double latitude, double longitude) async {
  List nearbyCommunities = [];
  String url =
      '$baseUrl/place/around?key=$apiKey&location=$longitude,$latitude&radius=500&types=住宅小区';
  try {
    var response = await http.get(url);
    for (var element in (response['pois'] as List)) {
      nearbyCommunities.add(element);
    }
  } catch (e) {
    print('查询过程中出现错误: $e');
  }
  return nearbyCommunities;
}
